/**
 * 
 */
package data.model.effort;

import data.model.ProjectDeveloper;
import data.model.ProjectWeek;

/**

 * 
 */
public class EstimatedEffort extends Effort {
	private final ProjectWeek projectWeek;

	/**
	 * @param text
	 * @param projectDeveloper
	 */
	public EstimatedEffort(ProjectWeek projectWeek) {
		super("Estimated");
		this.projectWeek = projectWeek;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortRequirementsEngineering()
	 */
	@Override
	public int getEffortRequirementsEngineering() {
		int effort = 0;
		for (ProjectDeveloper projectDeveloper : projectWeek
				.getInvolvedDevelopers()) {
			effort += projectDeveloper.getEstimatedEffortUntilWeek(
					projectWeek.getWeekNumber())
					.getEffortRequirementsEngineering();
			projectDeveloper.getEstimatedEffort().addPropertyChangeListener(
					this);
		}
		return effort;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortArchitectureAndDesign()
	 */
	@Override
	public int getEffortArchitectureAndDesign() {
		int effort = 0;
		for (ProjectDeveloper projectDeveloper : projectWeek
				.getInvolvedDevelopers()) {
			effort += projectDeveloper.getEstimatedEffortUntilWeek(
					projectWeek.getWeekNumber())
					.getEffortArchitectureAndDesign();
		}
		return effort;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortImplementationAndIntegration()
	 */
	@Override
	public int getEffortImplementationAndIntegration() {
		int effort = 0;
		for (ProjectDeveloper projectDeveloper : projectWeek
				.getInvolvedDevelopers()) {
			effort += projectDeveloper.getEstimatedEffortUntilWeek(
					projectWeek.getWeekNumber())
					.getEffortImplementationAndIntegration();
		}
		return effort;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortBuildAndTest()
	 */
	@Override
	public int getEffortBuildAndTest() {
		int effort = 0;
		for (ProjectDeveloper projectDeveloper : projectWeek
				.getInvolvedDevelopers()) {
			effort += projectDeveloper.getEstimatedEffortUntilWeek(
					projectWeek.getWeekNumber()).getEffortBuildAndTest();
		}
		return effort;
	}

	/*
	 * (non-Javadoc)
	 * 
	 * @see data.EffortProvider#getEffortProjectManagement()
	 */
	@Override
	public int getEffortProjectManagement() {
		int effort = 0;
		for (ProjectDeveloper projectDeveloper : projectWeek
				.getInvolvedDevelopers()) {
			effort += projectDeveloper.getEstimatedEffortUntilWeek(
					projectWeek.getWeekNumber()).getEffortProjectManagement();
		}
		return effort;
	}

}
